home *** CD-ROM | disk | FTP | other *** search
/ Developer Source 4 / developer source - volume 4.iso / cuser / apr96 / seekf102.gif < prev   
Graphics Interchange Format  |  1996-07-30  |  105KB  |  464x642  |  4-bit (16 colors)
Labels: text | screenshot | handwriting | font | rectangle | document
OCR: Figure 2 Terminating a worker process Parent kproc Worker (child) kproc X - new My kproc ("worker"); " 1 -> the worker kproc is born x-> start(); 2 -= trigger execution of: AIX_main() X-> dootherStuff ( ); processwork() while (AIX okTocontinue()) dolourWork() ; delete x if (!processbying) destroyProcess() wakeupKernel = TRUE; processbying - TRUES ATK _sendTerm(); it ( wakeupkernel) AIX notifyTerm( ); AIX exite(); ] /{ end AIX main() Step 1: The parent creates the kproc object. The constructor creates a new (child) kernel kproc. Step 2: The parent kproc initializes the worker (child) kproc. The worker kproc starts executing AIX_main(). The parent process kproc is free to do other work while the worker kproc invokes process Work() to perform its designated task. Step 3: The parent kproc deletes the worker. The destructor sends a termination signal to the worker. The worker catches the signal in the while loop of process WorkO). process Work() quits. The worker flow of control moves on to destroy Process(). Step 4: destroyProcess() cleans up and dies. Just prior to committing suicide, it notifies the parent kproc. The parent kproc wakes up and proceeds execution of the destructor code.